package com.xc.freeapp.filter;

import java.lang.reflect.Method;
import org.apache.log4j.Logger;

import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.RequestBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xc.freeapp.util.TokenAnnotation;

/**
 * 请求拦截处理类
 * 
 * 
 */
public class RequestLogInterceptor implements MethodBeforeAdvice {
	private Logger log = Logger.getLogger(this.getClass());

	public void before(Method method, Object[] args, Object target)
			throws Throwable {
		
		try{
			String arg="";
			for (Object object : args) {
					if(object instanceof Exception){
						
					}else{
						arg=arg+JSONObject.toJSONString(args)+"|";			
					}
					
			}
			log.info("调用接口:" + method.getDeclaringClass().getSimpleName() + "."
					+ method.getName() + "+请求数据为" + arg);
		}catch(Exception e){
			log.debug("日志打印失败");
		}
		
	}
}